﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IRCServer.CommandHandlers;

namespace IRCServer.Entities.Commands
{
    class PRIVMSGCommand: IRCCommandBase
    {
        public PRIVMSGCommand(string[] parameters) :
            base(parameters)
        {
            if (parameters.Length > 0)
            {
                this.Targets = parameters[0].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            }

            if (parameters.Length > 1)
            {
                this.Message = parameters[1];
            }
        }

        public string Message { get; set; }

        public List<string> Targets { get; set; }

        public override string ExecuteCommand(Session session)
        {
            PRIVMSGCommandHandler handler = new PRIVMSGCommandHandler();
            return handler.HandleCommand(this, session);
        }
    }
}
